home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / d3_lists.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-25  |  1.8 KB  |  79 lines

  1. /*****************************************************************************
  2.   FILE           : d3_lists.c
  3.   SHORTNAME      : lists.c
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : create a linear list
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Ralf Huebner
  10.   DATE           : 1.12.199
  11.  
  12.   CHANGED BY     : Sven Doering
  13.   IDENTIFICATION : @(#)d3_lists.c    1.9 3/2/94
  14.   SCCS VERSION   : 1.9
  15.   LAST CHANGE    : 3/2/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <malloc.h>
  23. #include <X11/Xlib.h>
  24. #include <X11/Intrinsic.h>
  25.  
  26. #include "glob_typ.h"
  27.  
  28. #include "d3_global.h"
  29. #include "d3_lists.h"
  30. #include "d3_lists.ph"
  31.  
  32.  
  33. /*****************************************************************************
  34.   FUNCTION : d3_insertUnit
  35.  
  36.   PURPOSE  : creates a new list entry
  37.   RETURNS  : a pointer to the new list
  38.   NOTES    :
  39.  
  40. ******************************************************************************/
  41.  
  42. void d3_insertUnit (d3_unitPtrType **list, int num)
  43. {
  44.     d3_unitPtrType *new_elem;
  45.  
  46.     new_elem = (d3_unitPtrType *) malloc (sizeof (d3_unitPtrType));
  47.     if (new_elem == NULL)
  48.       {
  49.          fprintf (stdout, "D3-Error: Not Enough Memory\n\n");
  50.          return;
  51.       }
  52.     new_elem->unitNo = num;
  53.     new_elem->next = *list;
  54.     *list = new_elem;
  55. }
  56.  
  57.  
  58.  
  59. /*****************************************************************************
  60.   FUNCTION : d3_displayUnitList
  61.  
  62.   PURPOSE  : writes a list to stdout
  63.   RETURNS  : 
  64.   NOTES    :
  65.  
  66. ******************************************************************************/
  67. void d3_displayUnitList (d3_unitPtrType  *list)
  68. {
  69.     while (list != NULL)
  70.       {
  71.         fprintf (stdout, "%7d", list->unitNo);
  72.         list = list->next;
  73.       }
  74.     fprintf (stdout, "\n");
  75. }
  76.  
  77. /* end of file */
  78. /* lines: 83 */
  79.